# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
# based on arch linux PKGBUILD
pkgname=apache-orc
pkgver=1.7.5
pkgrel=0
pkgdesc="the smallest, fastest columnar storage for Hadoop workloads"
url="https://orc.apache.org/"
arch="all"
license="Apache-2.0"
# tests require /etc/localtime
options="!check"
makedepends="
	cmake
	lz4-dev
	protobuf-dev
	samurai
	snappy-dev
	zlib-dev
	zlib-static
	zstd-dev
	"
subpackages="$pkgname-dev $pkgname-doc"
source="https://downloads.apache.org/orc/orc-$pkgver/orc-$pkgver.tar.gz
	tests.patch
	"
builddir="$srcdir/orc-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DSNAPPY_HOME=/usr \
		-DZLIB_HOME=/usr \
		-DLZ4_HOME=/usr \
		-DGTEST_HOME=/usr \
		-DZSTD_HOME=/usr \
		-DPROTOBUF_HOME=/usr \
		-DBUILD_LIBHDFSPP=OFF \
		-DBUILD_JAVA=OFF \
		-DINSTALL_VENDORED_LIBS=OFF \
		-DBUILD_POSITION_INDEPENDENT_LIB=ON \
		-DSTOP_BUILD_ON_WARNING=OFF \
		-DBUILD_CPP_TESTS=OFF \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
941a2545f1c5a17befb6e0bf96accbdc7354faf8fcc010731511a758cb404fdedf12b8ba86e7fce93c1dc04a6753be408632c0e3288bad2b61a92c495dd373e7  orc-1.7.5.tar.gz
0c2ac9d3756ad21f5222857d3f1a7e045686b330c6418e2c1d4a48ac5980cf58b95c3ee36cbdf43b9e04534c7269f680963ac3977b8f1877874338efe0a212f6  tests.patch
"
